#ifndef __GAME_PLAY_SCENE_H__
#define __GAME_PLAY_SCENE_H__

#include "cocos2d.h"
#include "Resource.h"
#include "GameManager.h"
#include "GameOverScene.h"
#include "ui/CocosGUI.h"
#include "cocostudio/CocoStudio.h"
#include "buttonApp.h"

USING_NS_CC;
using namespace ui;
using namespace cocostudio;

class GamePlayScene : public Layer
{
public:
	
	GamePlayScene();
	~GamePlayScene();
    static Scene* createScene();    
    virtual bool init();   
    CREATE_FUNC(GamePlayScene);
	
	void addBackgroundScene();
	void playAnimTimerLeft();
	void playAnimTimerRight();	

	// Get random type mini game
	int	 getArrNumberType(char* arr[]);
	void getRanMiniGameLeft();
	void getRanMiniGameRight();

	// Update question on left
	void updateQuestionLeft();
	void justmatch_Paint();
	void operations_Paint();
	void RPS_Paint();
	void sumof12_Paint();
	void Whereisit_Paint();
	void resetLayerLeft(float dt);
	void pressButtonWinLeft(Ref* pSender, TouchEventType type);

	// Update question on right
	void updateQuestionRight();
	void color_Paint();
	void concentration_Paint();
	void leftRight_Paint();
	void matching_Paint();
	void runner_Paint();
	void resetLayerRight(float dt);
	void pressButtonWinRight(Ref* pSender, TouchEventType type);
	void checkConcentration(Ref* pSender, TouchEventType type);

	// Chage int to string
	std::string chageInt2String(int i);
	bool checkGameFolder(std::vector<std::string> F_left, std::string indexFolder );

	void update(float dt);	
	void gotoGameOver();	
private:

	Sprite** lifeArray;
	// Count down life of MC
	int s_LifeCount;

	bool iAnimLeftRunning,iAnimRightRunning;
	Armature **animTimers;

	//  Type of mini game
	Layout **UILeft, **UIRight;

	// Text score
	Text *txt_NumberScore, *txt_NumberScoreLeft, *txt_NumberScoreRigth;
	int pointLeft, pointRight, PointSum;
	
	// Index type mini game
	int indexTypeLeft, indexTypeRight;

	// Timer
	int startTime;

	// Arr save type was play
	std::vector <int> ArrGameTypeLeft;
	std::vector <int> ArrGameTypeRight;
	std::vector <int> ArrGameFolderLeft;
	std::vector <int> ArrGameFolderRight;

	// check win wrong concentration
	std::vector<std::string> arrConcent;

};

#endif // __GAME_PLAY_SCENE_H__
